//
//  OAAccountSecurityVC.m
//  OA项目
//
//  Created by innofive on 2018/4/12.
//  Copyright © 2018年 inno. All rights reserved.
//

#import "OAAccountSecurityVC.h"
#import "OAMeCenterCell.h"
#import "OAAccountSecurityDeleteVC.h"
#import "OAAccountChangeVC.h"
#import "OAAccountChangePwsVC.h"
@interface OAAccountSecurityVC ()

@end

@implementation OAAccountSecurityVC

- (void)viewDidLoad {
    [super viewDidLoad];

    NSArray *arr  = @[
                      @[
                          @{@"anQuan":@"1",
                            @"title":@"账号安全"
                            }
                          
                          ],
                      @[@{@"anQuan":@"0",
                          @"title":@"更换手机号"
                          },
                        @{@"anQuan":@"0",
                          @"title":@"OA登录密码"
                          }]
                      ];
    
    [self.dataArr addObjectsFromArray:arr];
    
    
}

-(void)onLoadViewByWillAppear:(UITableView *)view
{
        view.backgroundColor = hexCOLOR(@"F1F1F1");
        view.separatorStyle = UITableViewCellSeparatorStyleNone;
}
#pragma mark - 点击事件

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    NSDictionary *dic = [self modelForIndexPath:indexPath];
    
    if (indexPath.section==1) {
       
        if (indexPath.row==0) {
            
            OAAccountChangeVC *vc = [[OAAccountChangeVC alloc]init];
            vc.title = dic[@"title"];
            [self pushToVC:vc];
        }else
        {
            OAAccountChangePwsVC *vc = [[OAAccountChangePwsVC alloc]initWithStyle:(UITableViewStyleGrouped) Type:openTypeCheckPsw];
            vc.title =@"验证原密码";
            [self pushToVC:vc];
        }
        
    }
    else
    {
            OAAccountSecurityDeleteVC *vc = [[OAAccountSecurityDeleteVC alloc]initWithStyle:(UITableViewStyleGrouped)];
            vc.title = dic[@"title"];
            [self pushToVC:vc];
    }
    
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return self.dataArr.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return [self.dataArr[section] count];
}

-(MCCellInfo *)tableView:(UITableView *)tableView cellForIndexPath:(NSIndexPath *)indexPath IsHeight:(BOOL)isheight
{
    return [MCCellInfo configForCellId:cell Class:[OAMeCenterCell1 class] Height:kFitH(50) TableView:tableView];
}

-(MCHFViewInfo *)tableView:(UITableView *)tableView HeaderInSection:(NSInteger)section isBiao:(BOOL)isBiao
{
    return [MCHFViewInfo configForViewId:header Class:[OAMeCenterheaderView class] Height:kFitH(10) TableView:tableView IsBian:NO];
}

-(id)modelForIndexPath:(NSIndexPath *)indexPath
{
    return self.dataArr[indexPath.section][indexPath.row];
};


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath];
    
    // Configure the cell...
    
    return cell;
}
*/

/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
